home *** CD-ROM | disk | FTP | other *** search
/ Animations / Animations CD.iso / mainactor / rexx / scale_adpro.ma < prev    next >
Text File  |  1993-12-04  |  3KB  |  144 lines

  1. /*
  2.  *
  3.  *     Scale V 1.1, 1993 Markus Moenig
  4.  *
  5.  *     Scales the source project to a requested size, needs AdPro !!
  6.  *     The new project will also be in the format of the selected save module.
  7.  *
  8.  *     The loader/saver of the source project can be either picture
  9.  *     or animation modules.
  10.  *
  11.  *     A new project will be opened for the resulting pictures/animation.
  12.  */
  13.  
  14. OPTIONS RESULTS
  15.  
  16. ADDRESS MAINACTOR 
  17.  
  18. ScreenToFront
  19. PrintAndStoreTXT "Scale V1.1, scaling project ..."
  20.  
  21. IF ~SHOW('P','ADPro') THEN DO  /* if not allready running, start adpro */
  22.     ADDRESS MAINACTOR PrintTXT "Invoking AdPro ..."
  23.     ADDRESS COMMAND 'run >NIL: <NIL: adpro:adpro BEHIND MAXMEM=1000000'
  24.     ADDRESS COMMAND Wait 5
  25. END  
  26.  
  27. ADDRESS MAINACTOR
  28.  
  29. GetSPName
  30.  
  31. IF rc = 0 THEN DO                          /* check if project loaded */
  32.  
  33.     PARSE VAR RESULT firstname secondname .  /* store name of the animation */
  34.                                              /* or the names of the picture list */
  35.     ScreenToFront
  36.  
  37.     DeSelectAll
  38.  
  39.     GetSPSaver
  40.     PARSE VAR RESULT savertype savername .   /* store type, name of saver module */
  41.  
  42.                                            /* Store general infos of the project */
  43.     GetSPInfo
  44.     PARSE VAR RESULT width height colors pics caching loop cpf .
  45.  
  46.     RequestInteger width "Enter new Width"
  47.     IF RC = 10 THEN DO
  48.         PrintTXT "Aborting ..."
  49.         EXIT
  50.     END
  51.     newxsize=RESULT
  52.  
  53.     RequestInteger height "Enter new Height"
  54.     IF RC = 10 THEN DO
  55.         PrintTXT "Aborting ..."
  56.         EXIT
  57.     END
  58.     newysize=RESULT
  59.     Scale=newxsize || " " || newysize
  60.  
  61.     IF savertype = "PIC" THEN
  62.         picformat=savername
  63.     ELSE DO
  64.         picformat=IFF
  65.         SetSPSaver PIC picformat
  66.     END
  67.     
  68.     ADDRESS "ADPro"
  69.         LFormat "Universal"
  70.         PSTATUS UNLOCKED
  71.         ORIENTATION PORTRAIT
  72.         SFormat picformat
  73.  
  74.     ADDRESS MAINACTOR
  75.  
  76.     RequestSaveFile "Select Name of Project" /* Ask for Project Name */
  77.  
  78.     IF RC = 10 THEN DO
  79.         PrintTXT "Aborting ..."
  80.         EXIT
  81.     END
  82.  
  83.     newname = RESULT                         /* new name = RESULT */
  84.  
  85.     SelectAll
  86.     
  87.     saveargs=newname
  88.         
  89.     Save saveargs                            /* Save Pictures */
  90.  
  91.     DO i=1 to pics                           /* Scale all pics */
  92.  
  93.         actualpic=newname || "." || Right("00000" || i, 5)
  94.     PrintTxt "ADPro scales Picture" i
  95.  
  96.         ADDRESS "ADPro"    
  97.         Load actualpic
  98.         RENDER_TYPE colors
  99.         ABS_SCALE Scale
  100.         PSORT 0
  101.         Execute    
  102.         Save actualpic IMAGE
  103.  
  104.         ADDRESS MAINACTOR
  105.  
  106.     END
  107.  
  108.     IF caching = "CACHING=YES" THEN                 /* Was the old project cached ? */
  109.         
  110.         OpenNewProject "CACHING"               /* If yes new project is also cached */
  111.     
  112.     ELSE 
  113.         
  114.         OpenNewProject                         /* If not new project is not cached */
  115.  
  116.     SetSPLoader PIC picformat                /* Set the new projects loader module */
  117.  
  118.     firstpic=newname || "." || Right("00000" || 1, 5)
  119.     lastpic=newname || "." || Right("00000" || pics, 5)
  120.  
  121.     LoadProject firstpic lastpic             /* Load picture list */
  122.  
  123.     SetSPSaver savertype savername
  124.  
  125.     IF savertype = "ANIM" THEN DO            /* If we wanted a new animation, */
  126.                                              /* we have to build it */
  127.         SelectAll
  128.         saveargs=newname || " " || cpf || " " || loop
  129.         Save saveargs
  130.         UnloadProject
  131.         
  132.         DO i=1 TO pics                         /* delete temporary pics */
  133.             actualpic=newname || "." || Right("00000" || i, 5)
  134.             PrintTxt "Delete " || actualpic
  135.             ADDRESS COMMAND    "delete " || actualpic || "#?"
  136.         END
  137.         
  138.         SetSPLoader savertype savername
  139.         LoadProject newname
  140.     END
  141.     
  142.     PrintAndStoreTXT "READY !!!!"
  143. END
  144.